const rootFontSize = 100 // 默认字体大小
// update font size of root when window resize
function setHtmlFont() {
  const docEl = document.documentElement
  const dpr = window.devicePixelRatio || 1

  // adjust body font size
  function setBodyFontSize() {
    if (document.body) {
      document.body.style.fontSize = `${16 * dpr}px`
    } else {
      document.addEventListener('DOMContentLoaded', setBodyFontSize)
    }
  }

  setBodyFontSize()

  function setRemUnit() {
    let rem = 16
    rem = (docEl.offsetWidth / 750) * 100
    docEl.style.fontSize = `${rem}px`
  }
  setRemUnit()
  // reset rem unit on page resize
  window.addEventListener('resize', setRemUnit)
  window.addEventListener('pageshow', (e) => {
    if (e.persisted) {
      setRemUnit()
    }
  })
}

window.onload = function () {
  setHtmlFont()
  var app = new Vue({
    el: '#app',
    data: {
      isClick: false,
      showText: false
    },
    methods: {
      clickImg() {
        this.isClick = !this.isClick
        setTimeout(() => {
          this.showText = true
        }, 5500)
      }
    }
  })
}
